#include<bits/stdc++.h>
using namespace std;
vector<int> q[100005];
int vis[100005];
int dis[50][50],dis1[50][50];
int n,k;
void op(int x,int b,int fa) {
    dis[x][b] = dis[fa][b]+1;
    dis1[x][b] = dis1[fa][b]|vis[x];
    for(int u:q[x]) {
        if(u == fa)continue;
        op(u,b,x);
    }
} int ans = 0;
void dfs(int x) {
    if(x > n) {
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++)
                dis[i][j] = 0,dis[i][j] = 0;
        for(int i=1;i<=n;i++)
            op(i,i,0);
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++)
                if(dis[i][j] == k&&vis[i]&&vis[j]||dis[i][j] == k&&!dis1[i][j])
                    return ;
        for(int i=1;i<=n;i++)
            cout<<vis[i]<<" ";cout<<"\n";
        ans ++;
        return ;
    }
    vis[x] = 0; dfs(x+1);
    vis[x] = 1; dfs(x+1);
}
int main()
{
    freopen("life.in","r",stdin);
    freopen("life.out","w",stdout);
    cin>>n>>k;
    for(int i=1;i<n;i++) {
        int u,v;
        cin>>u>>v;
        q[u].push_back(v);
        q[v].push_back(u);
    } dfs(1);
    if(ans)cout<<"YES\n"<<ans;
    else cout<<"NO";
    return 0;
}